<template>
  <van-list>
    <van-cell
      v-for="(item, index) in props.list"
      :key="index"
      :title="item.title"
      :label="props.showDesc ? item.describe : ''"
      @click="handleClick(item)"
    >
      <template #right-icon v-if="item.answer.type === 'link'">
        <van-icon name="link-o" class="search-icon" />
      </template>
    </van-cell>
  </van-list>
</template>
<script setup lang="ts">
const props = defineProps<{
  list: DataList[];
  showDesc: false;
}>();
import { useRouter } from 'vue-router';
// const router = useRouter();

function handleClick(data: DataList) {
  console.log(data);
  switch (data.answer.type) {
    case 'link':
      window.open(data.answer.url);
  }
}
</script>
<style scoped lang="scss"></style>
